<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<html lang="en">

<head>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link href="css/style.css" rel="stylesheet">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">

<title>Reportes Comisiones y Premios</title>
<link rel="stylesheet"
	href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<!-- Bootstrap Core CSS -->
<link href="bootstrap/vendor/bootstrap/css/bootstrap.css"
	rel="stylesheet">

<!-- Custom Fonts -->
<link href="https://fonts.googleapis.com/css?family=Lato"
	rel="stylesheet">
<link
	href="https://fonts.googleapis.com/css?family=Catamaran:100,200,300,400,500,600,700,800,900"
	rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Muli"
	rel="stylesheet">

<!-- Plugin CSS -->
<link rel="stylesheet"
	href="bootstrap/vendor/font-awesome/css/font-awesome.css">
<link rel="stylesheet"
	href="bootstrap/vendor/simple-line-icons/css/simple-line-icons.css">

<!-- Theme CSS -->
<link href="bootstrap/css/new-age.css" rel="stylesheet">

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.bootstrap/js/1.4.2/respond.min.js"></script>
    <![endif]-->
<script>
	$(function() {
		var date = $('#fechainicio').datepicker({
			dateFormat : 'yy-mm-dd'
		}).val();
		var date = $('#fechafin').datepicker({
			dateFormat : 'yy-mm-dd'
		}).val();

		var date = $('#fechapremio').datepicker({
			dateFormat : 'yy-mm-dd'
		}).val();

	});
</script>

<script>
	function verify_fecha() {
		if (document.forms[0].elements['fechainicio'].value == ''
				|| document.forms[0].elements['fechafin'].value == '') {
			alert('Eliga una fecha ')
		}

	}

	
	function today() {
		var today = new Date();
		var dd = today.getDate();
		var mm = today.getMonth() + 1; //January is 0!
		var yyyy = today.getFullYear();

		if (dd < 10) {
			dd = '0' + dd
		}

		if (mm < 10) {
			mm = '0' + mm
		}

		today = yyyy + '-' + mm + '-' + dd;
		document.getElementById("fechainicio").value = today;
		document.getElementById("fechafin").value = today;
	}
</script>


</head>

<body id="page-top" onload="today();">

	<nav id="mainNav" class="navbar navbar-default navbar-fixed-top">
	<div class="container">
		<!-- Brand and toggle get grouped for better mobile display -->
		<div class="navbar-header">
			<button type="button" class="navbar-toggle collapsed"
				data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
				<span class="sr-only">Toggle navigation</span> Menu <i
					class="fa fa-bars"></i>
			</button>
			<a class="navbar-brand page-scroll" href="index.jsp">Index</a>
		</div>

		<!-- Collect the nav links, forms, and other content for toggling -->
		<div class="collapse navbar-collapse"
			id="bs-example-navbar-collapse-1">
			<ul class="nav navbar-nav navbar-right">
<li>
                        <a class="page-scroll" href="ActualizarPremiosServlet">Actualizar Premios y Comisiones</a>
                    </li>
                    <li>
                        <a class="page-scroll" href="ObtenerReportesComisionesPremios">Obtener Reportes</a>
                    </li>
			</ul>
		</div>
		<!-- /.navbar-collapse -->
	</div>
	<!-- /.container-fluid --> </nav>




	<section class="reportes">
	<div class="cta-content">
		<div class="container">
	
			<c:if
				test="${UsuarioLogeado.categoria == 'Recursos Humanos'}">
	
	
		<c:if test="${not empty MensajeReportes}">	
							
				<%@ include file="/bootstrap/MensajeSuperior.jsp" %>				
   					${MensajeReportes}
 				<%@ include file="/bootstrap/MensajeInferior.jsp" %> 
 								
 				 </c:if>	
	
		<form
		action="${pageContext.request.contextPath}/ObtenerReportesComisionesPremios"
		method="post">

		<div>
			<h1>Obtener reporte de Comisiones y premios</h1>

			<div>
				
				<h3>Fecha Inicio</h3>
				<input type="text" id="fechainicio" name="fechainicio" readonly  class="inputs">
				<h3>Fecha Fin</h3>
				<input type="text" id="fechafin" name="fechafin" readonly  class="inputs"> </br>
				</br> </br> </br> <input type="submit" name="btnComisionPorVentas"
					value="Generar Reporte"
					onclick="verify_fecha()">

				

</br> </br> 


					<c:if test="${not empty Resultados}">
						<div class="contenido" style="margin: auto; width: 50%;">

							<table class="table-fill">

								<tr>
									<th colspan="4">
										<h3>Resultados</h3>
									</th>
								</tr>
								<tr>
									<td>Vendedor</td>
									<td>Comision</td>
									<td>Premio</td>
									<td>Total</td>

								</tr>


								<c:forEach items="${Resultados}" var="Resultado">
									<tr>
										<td>${Resultado.vendedor}</td>
											<c:if test="${Resultado.comision == 0}">
												<td>-</td>
											</c:if>
											<c:if test="${Resultado.comision != 0}">
												<td>$ ${Resultado.comision}</td>
											</c:if>
											
											<c:if test="${Resultado.premio == 0}">
												<td>-</td>
											</c:if>
											<c:if test="${Resultado.premio != 0}">
												<td>$ ${Resultado.premio}</td>
											</c:if>
											
												<c:if test="${Resultado.total == 0}">
												<td>-</td>
											</c:if>
											<c:if test="${Resultado.total != 0}">
												<td>$ ${Resultado.total}</td>
											</c:if>
									
									
										

									</tr>


								</c:forEach>



							</table>
							
						</div>
					</c:if>
				
			</div>
		</div>

	</form>
		</c:if>

   <c:if
		test="${empty UsuarioLogeado || UsuarioLogeado.categoria != 'Recursos Humanos'}">
		<h3>Ingrese con un usuario de RRHH para proceder.</h3>
		</c:if>

</br> </br> </br> </br>
								</br> </br> </br> </br>
		</div>
	</div>

	</section>













































	<footer>
	<div class="container">
		<p>&copy; 2016 F. Leandro - TSSI.</p>
		<ul class="list-inline">
			<li><a href="#">TP</a></li>
			<li><a href="#">Prog.</a></li>
			<li><a href="#">II</a></li>
		</ul>
	</div>
	</footer>

	

	<!-- Bootstrap Core JavaScript -->
	<script src="bootstrap/vendor/bootstrap/js/bootstrap.min.js"></script>

	<!-- Plugin JavaScript -->
	<script
		src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>

	<!-- Theme JavaScript -->
	<script src="bootstrap/js/new-age.min.js"></script>

</body>

</html>
